﻿@{
   
}

<div class="container-fluid">

    <!-- BEGIN PAGE HEADER-->

    <div class="row-fluid">

        <div class="span12">
            <h3 class="page-title">添加销售单

							 <small></small>

            </h3>

            <ul class="breadcrumb">

                <li>

                    <i class="icon-home"></i>

                    <a href="/Admin/Index">操作中心面板</a>

                    <span class="icon-angle-right"></span>

                </li>

                <li>

                    <a href="#">销售单管理</a>

                    <span class="icon-angle-right"></span>

                </li>

                <li><a href="#">添加销售单</a></li>

            </ul>

        </div>

    </div>

    <!-- END PAGE HEADER-->

    <!-- BEGIN PAGE CONTENT-->
    <div class="row-fluid">

        <div class="span12">

            <!-- BEGIN VALIDATION STATES-->

            <div class="portlet box blue tabbable">

                <div class="portlet-title">

                    <div class="caption">

                        <i class="icon-reorder"></i>

                        <span class="hidden-480">添加销售单</span>

                    </div>

                </div>

                <div class="portlet-body form">

                    <div class="tabbable portlet-tabs">

                        <ul class="nav nav-tabs">

                            <li class="active"><a href="#portlet_tab1" data-toggle="tab">销售单信息</a></li>

                        </ul>

                        <div class="tab-content">

                            <div class="tab-pane active" id="portlet_tab1">

                                <!-- BEGIN FORM-->
                                <form id="form_sample_1" class="form-horizontal" novalidate="novalidate">

                                    <div class="alert alert-error hide">

                                        <button class="close" data-dismiss="alert"></button>
                                        @*@Html.ValidationSummary(true, "登录不成功。请更正错误并重试。")*@
                                        登录不成功。请更正错误并重试。
                                    </div>

                                    <div class="alert alert-success hide">

                                        <button class="close" data-dismiss="alert"></button>

                                        Your form validation is successful!

                                    </div>
                                    <div class="row-fluid">
                                        <div class="span8">
                                            <div class="control-group">

                                                <label class="control-label">单据编号:</label>
                                                <label class="control-label"><span class="required">XS201310220001</span></label>


                                            </div>
                                        </div>
                                        <div class="span4">
                                            <div class="controls">
                                                <button type="button" class="btn blue">查看历史单据</button>
                                            </div>
                                        </div>
                                    </div>


                                    <div class="row-fluid">
                                        <div class="span6">
                                            <div class="control-group">
                                                <label class="control-label"></label>
                                                <div class="controls">
                                                    <label class="radio">
                                                        <input type="radio" name="optionsRadios2" value="option1" />
                                                        销售进货

                                                    </label>
                                                    <label class="radio">
                                                        <input type="radio" name="optionsRadios2" value="option2" checked />
                                                        销售退货

                                                    </label>

                                                </div>

                                            </div>
                                        </div>
                                        <div class="span6">
                                            <div class="control-group">

                                                <label class="control-label">客户</label>

                                                <div class="controls">
                                                    <select data-placeholder="客户名称" class="chosen-with-diselect span12" tabindex="-1" id="selCSI">

                                                        <option value=""></option>

                                                        <option>American Black Bear</option>

                                                    </select>
                                                </div>

                                            </div>
                                        </div>

                                    </div>

                                    <div class="row-fluid">
                                        <div class="" role="grid">
                                            <div class="row-fluid">
                                            </div>
                                        </div>
                                        <div id="sample_1_wrapper" class="dataTables_wrapper form-inline" role="grid">

                                            <table class="table table-striped table-bordered table-hover dataTable" id="sample_1" aria-describedby="sample_1_info">

                                                <thead>

                                                    <tr role="row">
                                                        <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 40px;">行号</th>
                                                        <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 200px;">品名规格</th>
                                                        <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 40px;">单位</th>
                                                        <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 120px;">货品类别</th>
                                                        <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 80px;">数量</th>
                                                        <th class="sorting_disabled center" role="columnheader" rowspan="1" colspan="1" style="width: 118px;">单价</th>
                                                        <th class="sorting_disabled center" role="columnheader" rowspan="1" colspan="1" style="width: 118px;">金额</th>
                                                        <th class="sorting_disabled center" role="columnheader" rowspan="1" colspan="1" style="width: 118px;">备注</th>
                                                    </tr>

                                                </thead>



                                                <tbody role="alert" aria-live="polite" aria-relevant="all">
                                                    <tr class="odd">


                                                        <td>1</td>

                                                        <td>

													       <input id="11" name="pname" type="text" class="span12 m-wrap" style="margin: 0 auto;" data-provide="typeahead" />

                                                        </td>

                                                        <td>吨</td>

                                                        <td class="hidden-480">裤子类</td>

                                                        <td><input type="text" name="cnowowing" data-required="1" class="span12 m-wrap"></td>

                                                        <td><input type="text" name="cnowowing" data-required="1" class="span12 m-wrap"></td>
                                                        <td><span class="label label-success">总价</span></td>
                                                        <td><input type="text" name="cnowowing" data-required="1" class="span12 m-wrap"></td>
                                                    </tr>
                                                </tbody>
                                            </table>

                                        </div>
                                    </div>
                                    <div class="control-group">

                                        <label class="control-label">备注<span class="required">*</span></label>

                                        <div class="controls">

                                            <input type="text" name="cinfo" data-required="1" class="span10 m-wrap">
                                        </div>

                                    </div>
                                    <div class="row-fluid">
                                        <div class="span4">
                                            <div class="control-group">

                                                <label class="control-label">折后应收金额<span class="required">*</span></label>

                                                <div class="controls">

                                                    <input type="text" name="cfax" data-required="1" class="span10 m-wrap">
                                                    <span class="help-inline">元</span>
                                                </div>

                                            </div>
                                        </div>
                                        <div class="span4">
                                            <div class="control-group">

                                                <label class="control-label">折扣<span class="required">*</span></label>

                                                <div class="controls">

                                                    <input type="text" name="cqq" data-required="1" class="span4 m-wrap">
                                                    <span class="help-inline">折</span>
                                                </div>

                                            </div>
                                        </div>
                                        <div class="span4">
                                            <div class="control-group">

                                                <label class="control-label">总额<span class="required">*</span></label>

                                                <div class="controls">

                                                    <input type="text" name="cemail" data-required="1" class="span10 m-wrap">
                                                    <span class="help-inline">元</span>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-actions">

                                        <button type="submit" class="btn blue">保存</button>

                                        <button type="button" class="btn">取消</button>

                                    </div>

                                </form>

                                <!-- END FORM-->

                            </div>
                        </div>

                    </div>

                </div>

            </div>

            <!-- END VALIDATION STATES-->

        </div>

    </div>

    <!-- END PAGE CONTENT-->

</div>
<!-- BEGIN PAGE LEVEL PLUGINS -->

<style>
    .form-horizontal .controls {
        margin-left: 120px;
    }

    .form-horizontal .control-label {
        float: left;
        width: 100px;
        padding-top: 5px;
        text-align: right;
    }
</style>
<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/jquery.validate.min.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/additional-methods.min.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/select2.min.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/chosen.jquery.min.js")"></script>

<link rel="stylesheet" href="@Url.Content("~/Content/ForAdmin/css/uploadify.css")" type="text/css">

<link rel="stylesheet" href="@Url.Content("~/Content/ForAdmin/css/bootstrap-toggle-buttons.css")" type="text/css">

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/jquery.uploadify-3.1.min.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/jquery.form.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/jquery.inputmask.bundle.min.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/jquery.toggle.buttons.js")"></script>

<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/ajaxformtool.js")"></script>

@*<script type="text/javascript" src="@Url.Content("~/Content/ForAdmin/js/form-components.js")"></script>*@
<!-- END PAGE LEVEL PLUGINS -->

<!-- BEGIN PAGE LEVEL STYLES -->
<!-- END PAGE LEVEL STYLES -->

<script>
    // for more info visit the official plugin documentation: 
    // http://docs.jquery.com/Plugins/Validation
    var form1 = $('#form_sample_1');
    var error1 = $('.alert-error', form1);
    var success1 = $('.alert-success', form1);

    form1.validate({
        errorElement: 'span', //default input error message container
        errorClass: 'help-inline', // default input error message class
        focusInvalid: false, // do not focus the last invalid input
        ignore: "",
        rules: {
            //待确认
        },

        invalidHandler: function (event, validator) { //display error alert on form submit              
            success1.hide();
            error1.show();
            App.scrollTo(error1, -200);
        },

        highlight: function (element) { // hightlight error inputs
            $(element)
                .closest('.help-inline').removeClass('ok'); // display OK icon
            $(element)
                .closest('.control-group').removeClass('success').addClass('error'); // set error class to the control group
        },

        unhighlight: function (element) { // revert the change dony by hightlight
            $(element)
                .closest('.control-group').removeClass('error'); // set error class to the control group
        },

        success: function (label) {
            label
                .addClass('valid').addClass('help-inline ok') // mark the current input as valid and display OK icon
            .closest('.control-group').removeClass('error').addClass('success'); // set success class to the control group
        },

        submitHandler: function (form) {
            success1.show();
            error1.hide();
            $.ajax({
                type: "POST",
                url: '/Admin/AddCustomer',
                data: getFormJson(form),
                error: function (request) {
                    alert(request);
                },
                success: function (data) {
                    $("#pid").val(data.Id);
                    var unique_id = $.gritter.add({
                        // (string | mandatory) the heading of the notification
                        title: '提示信息',
                        // (string | mandatory) the text inside the notification
                        text: data.Msg,
                        // (string | optional) the image to display on the left
                        //image: './assets/img/avatar1.jpg',
                        // (bool | optional) if you want it to fade out on its own or just sit there
                        //sticky: true,
                        // (int | optional) the time you want it to be alive for before fading out
                        //time: '',
                        // (string | optional) the class name you want to apply to that specific message
                        //class_name: 'my-sticky-class'
                    });
                    return false;
                }
            });
            return;
        }
    });

    $("[name$='pname']").typeahead({
        source: function (query, process) {
            return ['a', 'b', 'c', 'd', 'cc', 'aaaaaaaaaaaaaaaaaaaaaaaaaa', 'aaaa'];
        },
        updater: function (item) {
            this.$element;
            //alert(item)
            //this.$element.val(item);
            //alert(this.$element[0].parent().prev().attr["name"])
            //alert($(element).val());
            //("#dbInforDdId").val(ui.item.dbId);
            //this.$element.val(item).change();
            return item;
        },
        minLength: 2
    });
    

    $("#mask_number").inputmask({ "mask": "9", "repeat": 5, "greedy": false });
    $('.basic-toggle-button').toggleButtons();
</script>

<!-- END JAVASCRIPTS -->
<!-- END BODY -->
